Whew. Work through the last of the changes. The entire project builds
authorrobertlipe@gmail.com <robertlipe@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 26 Jul 2011 03:41:14 +0000 (03:41 +0000)
committerrobertlipe@gmail.com <robertlipe@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 26 Jul 2011 03:41:14 +0000 (03:41 +0000)
AND runs the test suite on Mac when built with either configure/make as C
or via Qmake/make as C++.

Now we can start fretting about things like using QTime to replace time_t
and how we're going to distribute Mae command line builds...

git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4078 f51c46e8-681c-474f-0cfe-069cfd0219fb

29 files changed:
gpsbabel/GPSBabel.pro
gpsbabel/an1sym.h
gpsbabel/brauniger_iq.c
gpsbabel/coto.c
gpsbabel/delbin.c
gpsbabel/destinator.c
gpsbabel/garmin_txt.c
gpsbabel/gcdb.c
gpsbabel/gdb.c
gpsbabel/geoniche.c
gpsbabel/ggv_log.c
gpsbabel/ggv_ovl.c
gpsbabel/gpilots.c
gpsbabel/igc.c
gpsbabel/mag_pdb.c
gpsbabel/maggeo.c
gpsbabel/magnav.c
gpsbabel/mapsend.c
gpsbabel/mapsource.c
gpsbabel/navicache.c
gpsbabel/overlay.c
gpsbabel/palmdoc.c
gpsbabel/pathaway.c
gpsbabel/pdbfile.c
gpsbabel/pocketfms_bc.c
gpsbabel/shape.c
gpsbabel/skytraq.c
gpsbabel/stmsdf.c
gpsbabel/stmwpp.c

index 9d2e92546892bb71ef0946a48b8ce54bb4a0d1cf..0ed184b4188f768b8f6ed01a88047f2bc3e2a099 100644 (file)
@@ -28,9 +28,9 @@ ALL_FMTS=$$MINIMAL_FMTS gtm.cc gpsutil.cc pcx.cc cetus.cc copilot.cc \
         jtr.cc sbp.cc sbn.cc mmo.cc skyforce.cc itracku.cc v900.cc delbin.cc \
         pocketfms_bc.cc pocketfms_fp.cc pocketfms_wp.cc naviguide.cc enigma.cc \
         vpl.cc teletype.cc jogmap.cc bushnell.cc bushnell_trl.cc wintec_tes.cc \
-        subrip.cc garmin_xt.cc explorist_ini.cc \
+        subrip.cc garmin_xt.cc \
 
-ALL_FMTS=$$MINIMAL_FMTS
+ALL_FMTS=$$MINIMAL_FMTS
 FILTERS=position.cc radius.cc duplicate.cc arcdist.cc polygon.cc smplrout.cc \
         reverse_route.cc sort.cc stackfilter.cc trackfilter.cc discard.cc \
         nukedata.cc interpolate.cc transform.cc height.cc swapdata.cc
@@ -86,9 +86,9 @@ macx {
 SOURCES += $$ALL_FMTS $$FILTERS $$SUPPORT $$SHAPE $$ZLIB $$JEEPS
 
 # We don't care about stripping things out of the build.  Full monty, baby.
-#DEFINES += MAXIMAL_ENABLED
+DEFINES += MAXIMAL_ENABLED
 DEFINES += FILTERS_ENABLED
-#DEFINES += PDBFMTS_ENABLED
-#DEFINES += SHAPELIB_ENABLED
-#DEFINES += CSVFMTS_ENABLED
-#DEFINES += CET_WANTED
+DEFINES += PDBFMTS_ENABLED
+DEFINES += SHAPELIB_ENABLED
+DEFINES += CSVFMTS_ENABLED
+DEFINES += CET_WANTED
index 8cbdcd4f58da0b9058495a19c6e30ea9cab4efd8..c2ef4582ce52aae6ccb7442b836a4f25f86bbf85 100644 (file)
@@ -725,7 +725,7 @@ int FindIconByGuid(GUID* guid, char** name)
   int i = 0;
   for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
     if (!memcmp(guid, &default_guids[i].guid, sizeof(GUID))) {
-      *name = default_guids[i].name;
+      *name = (char*) default_guids[i].name;
       return 1;
     }
   }
index 43f00122ae9700bcdbbc32e7e3970eedf4bf8fb1..30d0024b37452c586f6fc0affc0b2b4bd502416f 100644 (file)
@@ -27,7 +27,7 @@ static void* serial_handle;
 #define MYNAME "BRAUNIGER-IQ"
 #define PRESTRKNAME "PRESALTTRK"
 
-static enum {
+typedef enum {
   st_sync,
   st_fl_num,
   st_data_len,
@@ -45,7 +45,14 @@ static enum {
   st_sample_alt,
   st_sample_spd,
   num_states
-} state;
+} state_t;
+state_t state;
+#if __cplusplus
+inline state_t operator++(state_t& rs, int)
+{
+  return rs = (state_t)((int)rs + 1);
+}
+#endif
 
 static const int reqd_bytes[num_states] = { 6, 1, 2, 2, 25, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1 };
 
index 1219335baea87d06fc5368b8e5008e240e12cc29..a08d7b74d333a34346d658b334d499e8c4510317 100644 (file)
@@ -358,7 +358,7 @@ coto_wpt_write(const waypoint* wpt)
 
   if ((wpt->description) && ((strlen(wpt->description) > MAX_MARKER_NAME_LENGTH) || (strcmp(wpt->description, wpt->shortname)))) {
     if ((wpt->notes) && (strcmp(wpt->description, wpt->notes) != 0)) {
-      notes = xcalloc(strlen(wpt->description) + strlen(wpt->notes) + 9, 1);
+      notes = (char*) xcalloc(strlen(wpt->description) + strlen(wpt->notes) + 9, 1);
       sprintf(notes, "%s\nNotes:\n%s", wpt->description, wpt->notes);
     } else {
       notes = xstrdup(wpt->description);
@@ -371,7 +371,7 @@ coto_wpt_write(const waypoint* wpt)
   if (notes != NULL) {
     size += strlen(notes);
   }
-  rec = xcalloc(size, 1);
+  rec = (struct record_wpt*) xcalloc(size, 1);
 
   pdb_write_double(&rec->lon, RAD(-wpt->longitude));
   pdb_write_double(&rec->lat, RAD(wpt->latitude));
@@ -419,7 +419,7 @@ data_write(void)
 
 ff_vecs_t coto_vecs = {
   ff_type_file,
-  {ff_cap_read|ff_cap_write, ff_cap_read, ff_cap_none},
+  {(ff_cap)(ff_cap_read|ff_cap_write), ff_cap_read, ff_cap_none},
   rd_init,
   wr_init,
   rd_deinit,
index 84c07e59241026c38b9b0598e6d524b2cb246226..57b847aec0438edadf196ed05149086c9a626066 100644 (file)
@@ -631,7 +631,7 @@ message_write(unsigned msg_id, message_t* m)
   chksum = checksum(p + 2, 6);
   le_write16(p + 8, chksum);
   // message data (filled in by caller)
-  chksum = checksum(m->data, m->size);
+  chksum = checksum((gbuint8*) m->data, m->size);
   n = 2 + 8 + m->size;
   // trailer (checksum and marker bytes)
   le_write16(p + n, chksum);
@@ -727,9 +727,9 @@ message_read_1(unsigned msg_id, message_t* m)
     m->buf[0] = m->buf[1] = 0;
     memcpy(m->buf + 2, buf, 8);
     // read message body and trailer
-    read_depacketize(m->data, total);
+    read_depacketize((gbuint8*) m->data, total);
     p = (gbuint8*)m->data + m->size;
-    if (checksum(m->data, m->size) == le_readu16(p) &&
+    if (checksum((gbuint8*) m->data, m->size) == le_readu16(p) &&
         p[2] == 0xad && p[3] == 0xbc) {
       if (global_opts.debug_level >= DBGLVL_M) {
         warning(MYNAME ": received %x\n", id);
@@ -862,10 +862,13 @@ get_batch(message_t** array, unsigned* n)
   return success;
 }
 
-static struct {
+typedef struct {
   unsigned msg_id;
   message_t msg;
-}* batch_array;
+} batch_array_t;
+
+static batch_array_t* batch_array;
+
 static unsigned batch_array_max;
 static unsigned batch_array_i;
 
@@ -874,12 +877,12 @@ static void
 add_to_batch(unsigned id, message_t* m)
 {
   if (batch_array_i == batch_array_max) {
-    void* old = batch_array;
+    char* old = (char*) batch_array;
     if (batch_array_max == 0) {
       batch_array_max = 50;
     }
     batch_array_max += batch_array_max;
-    batch_array = xmalloc(batch_array_max * sizeof(*batch_array));
+    batch_array = (batch_array_t*) xmalloc(batch_array_max * sizeof(*batch_array));
     if (batch_array_i) {
       memcpy(batch_array, old, batch_array_i * sizeof(*batch_array));
       xfree(old);
@@ -2579,7 +2582,11 @@ static void*
 thread_func(void* run_loop_source)
 {
   run_loop = CFRunLoopGetCurrent();
+#if __cplusplus
+  CFRunLoopAddSource(run_loop, (__CFRunLoopSource*) run_loop_source, kCFRunLoopDefaultMode);
+#else
   CFRunLoopAddSource(run_loop, run_loop_source, kCFRunLoopDefaultMode);
+#endif
   CFRunLoopRun();
   return NULL;
 }
@@ -2632,7 +2639,7 @@ mac_os_init(const char* fname)
     fatal(MYNAME ": IOCreatePlugInInterfaceForService failed 0x%x\n", (int)kr);
   }
   IOObjectRelease(service);
-  hr = (*plugin)->QueryInterface(plugin, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122), (void*)&device);
+  hr = (*plugin)->QueryInterface(plugin, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122), (void**)&device);
   if (hr) {
     fatal(MYNAME ": QueryInterface failed 0x%x\n", (int)hr);
   }
index 34dc4e39ee58d44663d3ae45c129e747e74a4796..116c0c44efe6ef225593cdfab0664d4a61b535dd 100644 (file)
@@ -334,7 +334,7 @@ destinator_read_trk(void)
     wpt->microseconds = ((int)time % 1000) * 1000;
 
     if (wpt->fix > 0) {
-      wpt->fix++;
+      wpt->fix = (fix_type)(wpt->fix + 1);
     }
 
     if (! trk) {
index d79662e5062164b3d3c7fba65dc335af08e47e86..a6e288f9b957bad36122a2d2a1b59d067a04da1d 100644 (file)
@@ -73,6 +73,18 @@ typedef enum {
   unknown_header
 } header_type;
 
+#if __cplusplus
+inline header_type operator++(header_type& rs, int)
+{
+  return rs = (header_type)((int)rs + 1);
+}
+
+inline gt_display_modes_e  operator++(gt_display_modes_e& rs, int)
+{
+  return rs = (gt_display_modes_e)((int)rs + 1);
+}
+#endif
+
 #define MAX_HEADER_FIELDS 36
 
 static char* header_lines[unknown_header + 1][MAX_HEADER_FIELDS];
@@ -836,7 +848,7 @@ garmin_txt_write(void)
     xfree(wpt_a);
 
     route_idx = 0;
-    route_info = xcalloc(route_count(), sizeof(struct info_s));
+    route_info = (info_t*) xcalloc(route_count(), sizeof(struct info_s));
     routepoints = 0;
     route_disp_all(prework_hdr_cb, prework_tlr_cb, prework_wpt_cb);
     if (routepoints > 0) {
@@ -847,7 +859,7 @@ garmin_txt_write(void)
   }
 
   route_idx = 0;
-  route_info = xcalloc(track_count(), sizeof(struct info_s));
+  route_info = (info_t*) xcalloc(track_count(), sizeof(struct info_s));
   routepoints = 0;
   track_disp_all(prework_hdr_cb, prework_tlr_cb, prework_wpt_cb);
 
@@ -1021,7 +1033,7 @@ bind_fields(const header_type ht)
   /* make a copy of headers[ht], uppercase, replace "\t" with "\0" */
 
   i = strlen(headers[ht]);
-  fields = xmalloc(i + 2);
+  fields = (char*) xmalloc(i + 2);
   strcpy(fields, headers[ht]);
   strcat(fields, "\t");
   c = strupper(fields);
@@ -1325,7 +1337,7 @@ garmin_txt_rd_init(const char* fname)
   memset(&header_ct, 0, sizeof(header_ct));
 
   datum_index = -1;
-  grid_index = -1;
+  grid_index = (grid_type) -1;
 
   init_date_and_time_format();
 }
index 6f0c2815cb93d808e609977363fea589ba9c3352..76a744b06e9cb8c14de92993a3ded12945e37ea5 100644 (file)
@@ -170,13 +170,13 @@ waypt_add(wpt);
 
 
 static int
-gcdb_add_to_rec(struct dbrec* rec, const char* fldname, gcdb_rectype rectype, void* data)
+gcdb_add_to_rec(struct dbrec* rec, const char* fldname, gcdb_rectype rectype, const void* data)
 {
 int length;
 static int rec_cnt;
 
 if (!tbuf) {
-tbuf = xcalloc(MAXRECSZ, 1);
+tbuf = (char*) xcalloc(MAXRECSZ, 1);
 tbufp = tbuf;
 }
 
@@ -195,9 +195,9 @@ strncpy(rec->dbfld[rec_cnt].fldname, fldname, 4);
 
 switch (rectype) {
 case RECTYPE_TEXT:
-length = 1 + strlen(data);
+length = 1 + strlen((const char*)data);
 be_write16(&rec->dbfld[rec_cnt].fldlen, length);
-strcpy(tbufp, data);
+strcpy(tbufp, (const char*)data);
 tbufp += (length + 1) & (~1);
 break;
 case RECTYPE_DATE:
@@ -225,7 +225,7 @@ char tbuf[100];
 * We don't really know how many fields we'll have or how long
 * they'll be so we'll just lazily create a huge place to hold them.
 */
-rec = xcalloc(sizeof(*rec) + 500, 1);
+rec = (struct dbrec*) xcalloc(sizeof(*rec) + 500, 1);
 
 gcdb_add_to_rec(rec, "gcna", RECTYPE_TEXT, wpt->description);
 gcdb_add_to_rec(rec, "gcid", RECTYPE_TEXT, wpt->shortname);
@@ -273,7 +273,7 @@ gcdb_add_to_rec(rec, "date", RECTYPE_DATE, (void*) wpt->creation_time);
 /*
 * We're done.  Build the record.
 */
-reclen = gcdb_add_to_rec(rec, NULL, 0, NULL);
+reclen = gcdb_add_to_rec(rec, NULL, (gcdb_rectype)0, NULL);
 
 pdb_write_rec(file_out, 0, 2, ct++, rec, reclen);
 xfree(rec);
index aa8a6c23e70e2a31c523d46c2345c2e612cda1be..86100201a48262524ab793ba06476716bf914ee3 100644 (file)
@@ -493,7 +493,7 @@ read_waypoint(gt_waypt_classes_e* waypt_class_out)
 #if GDB_DEBUG
   sn = xstrdup(nice(res->shortname));
 #endif
-  wpt_class = FREAD_i32;
+  wpt_class = (gt_waypt_classes_e) FREAD_i32;
   GMSD_SET(wpt_class, wpt_class);
   if (wpt_class != 0) {
     waypth_ct++;
index 6cd53441df63eb08eb87e17ab0c5eacf5a7ff61e..4e9e0d05917f0b5f7fb1a2cf660fa14d311756c6 100644 (file)
@@ -162,7 +162,7 @@ field(char** pp, int* lenp)
     return NULL;
   }
 
-  dbuf = dp = xmalloc(len);
+  dbuf = dp = (char*) xmalloc(len);
   while (len) {
     char       ch;
 
@@ -189,7 +189,7 @@ field(char** pp, int* lenp)
   }
 eof:
   *dp++ = 0;
-  dbuf = xrealloc(dbuf, dp - dbuf);
+  dbuf = (char*) xrealloc(dbuf, dp - dbuf);
   /* fprintf(stderr, "<%.8s> dbuf=%x, len=%d\n", *pp, dbuf, len); */
   *pp = p;
   *lenp = len;
@@ -580,11 +580,11 @@ enscape(char* s)
   char*        buf, *d;
 
   if (!s) {
-    d =  xmalloc(1);
+    d = (char*) xmalloc(1);
     *d = 0;
     return d;
   }
-  buf = d = xmalloc(strlen(s) * 2 + 1);
+  buf = d = (char*) xmalloc(strlen(s) * 2 + 1);
   for (; *s; ++s) {
 
     /*
index 5372b5081a844df984f12fe848a51cfd00aa9746..ece06c5678a2689a9948641cfdae2632469c48ac 100644 (file)
@@ -103,7 +103,7 @@ ggv_log_read(void)
     break;
   }
 
-  buf = xmalloc(bufsz);
+  buf = (signed char*) xmalloc(bufsz);
 
   while ((len = gbfread(buf, 1, bufsz, fin))) {
     int deg, min;
index 169fe94ed6e98ff5ee84f7bbf7e1579aef857f38..43a293d70c9745f1bf2a1a0609f03f46652b772d 100644 (file)
@@ -324,7 +324,7 @@ route_disp_cb(const route_head* rte)
     waypoint* wpt = (waypoint*) elem;
 
     if (prev != NULL) {
-      draw_symbol_basics(OVL_SYMBOL_TRIANGLE, 1, 9 /* color */, prev);
+      draw_symbol_basics(OVL_SYMBOL_TRIANGLE, 1, (OVL_COLOR_TYP)9 /* color */, prev);
 
       gbfprintf(fout, "Width=12\n");
       gbfprintf(fout, "Height=8\n");
index aabdf0bb913b9b02f14fab12c3955f3bd97f70c0..55e04a189fa259294061712c47aa6a8bacc7c010 100644 (file)
@@ -290,7 +290,7 @@ data_read(void)
             } else {
               /* name in the form TRACKNAME #n */
               snprintf(trk_seg_num_buf, sizeof(trk_seg_num_buf), "%d", trk_seg_num);
-              track_head->rte_name = xmalloc(strlen(trk_name)+strlen(trk_seg_num_buf)+3);
+              track_head->rte_name = (char*) xmalloc(strlen(trk_name)+strlen(trk_seg_num_buf)+3);
               sprintf(track_head->rte_name, "%s #%s", trk_name, trk_seg_num_buf);
             }
             trk_seg_num++;
@@ -334,7 +334,7 @@ data_read(void)
             } else {
               /* name in the form TRACKNAME #n */
               snprintf(trk_seg_num_buf, sizeof(trk_seg_num_buf), "%d", trk_seg_num);
-              track_head->rte_name = xmalloc(strlen(trk_name)+strlen(trk_seg_num_buf)+3);
+              track_head->rte_name = (char*) xmalloc(strlen(trk_name)+strlen(trk_seg_num_buf)+3);
               sprintf(track_head->rte_name, "%s #%s", trk_name, trk_seg_num_buf);
             }
             trk_seg_num++;
@@ -376,7 +376,7 @@ my_write_wpt(const waypoint* wpt)
   char* vdata;
   int lat, lon;
 
-  rec = xcalloc(sizeof *rec, 1);
+  rec = (struct record*) xcalloc(sizeof *rec, 1);
   vdata = (char*)rec + sizeof(*rec);
 
   rec->header.type = 4;
@@ -421,7 +421,7 @@ data_write(void)
 
 ff_vecs_t gpilots_vecs = {
   ff_type_file,
-  { ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write, ff_cap_none},
+  { (ff_cap)(ff_cap_read | ff_cap_write), (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none},
   rd_init,
   wr_init,
   rd_deinit,
index 0dad151e897e11990ecc3f69709523bd069ea50d..2bc7dde78ad9feca8002dc6c51036e913034131d 100644 (file)
@@ -132,6 +132,14 @@ static void rd_deinit(void)
   gbfclose(file_in);
 }
 
+typedef enum { id, takeoff, start, turnpoint, finish, landing } state_t;
+#if __cplusplus
+inline state_t operator++(state_t& rs, int)
+{
+  return rs = (state_t)((int)rs + 1);
+}
+#endif
+
 /**
  * Handle pre- or post-flight task declarations.
  * A route is created for each set of waypoints in a task declaration.
@@ -153,8 +161,7 @@ static void igc_task_rec(const char* rec)
   char short_name[8];
   char tmp_str[MAXRECLEN];
   struct tm tm;
-
-  static enum { id, takeoff, start, turnpoint, finish, landing } state = id;
+  static state_t state = id;
 
   // First task record identifies the task to follow
   if (id == state) {
index a26c5acce2c85373c4c6ccf19f9509cb7bf776c7..2eb2b1df8196054def733bfb832474dd28a64cf0 100644 (file)
@@ -110,7 +110,7 @@ magpdb_read_data(const char* data, const size_t data_len)
 
           /* now we are looking for a sequence like 0,1 NE (123456,654321) */
 
-          buff = xmalloc(strlen(cin) + 1);             /* safe target space for sscanf( ... */
+          buff = (char*) xmalloc(strlen(cin) + 1);             /* safe target space for sscanf( ... */
 
           comma = cin;
           while ((comma = strchr(comma, separator))) {
index 27a0847226281699f1484f057e62f1b127f5d93d..954729d84afb19865ab27c04fbfcd1bbcba2e044 100644 (file)
@@ -177,7 +177,7 @@ maggeo_fmtdate(time_t t)
 
   struct tm* tm = NULL;
   int date;
-  char* cbuf = xmalloc(SZ);
+  char* cbuf = (char*) xmalloc(SZ);
 
   cbuf[0] = '\0';
   if (t > 0) {
index f3f639a20180c0980af35b8a930f69083c6c16c8..49a6a1e2862705bc297783359de9da8adbdd99cc 100644 (file)
@@ -139,7 +139,7 @@ my_writewpt(const waypoint* wpt)
                    mkshort_from_wpt(mkshort_handle, wpt) :
                    wpt->shortname;
 
-  rec = xcalloc(sizeof(*rec)+56,1);
+  rec = (struct record*) xcalloc(sizeof(*rec)+56,1);
 
   tm = NULL;
   if (wpt->creation_time) {
index ea1bfe3c8c2df85643af525cd4ec557175792170..407e4694f010d17b0a1ba7579fd576740402a96f 100644 (file)
@@ -419,7 +419,9 @@ void mapsend_track_hdr(const route_head* trk)
   queue* elem, *tmp;
   char* tname;
   int i;
-  mapsend_hdr hdr = {13, "4D533334 MS", "30", ms_type_track, {0, 0, 0}};
+  mapsend_hdr hdr = {13, {'4','D','5','3','3','3','3','4',' ','M','S'},
+    {'3','0'}, ms_type_track, {0, 0, 0}
+  };
 
   switch (trk_version) {
   case 20:
@@ -525,7 +527,9 @@ mapsend_track_write(void)
 static void
 mapsend_wpt_write(void)
 {
-  mapsend_hdr hdr = {13, {"4D533330 MS"}, {"30"}, ms_type_wpt, {0, 0, 0}};
+  mapsend_hdr hdr = {13, {'4','D','5','3','3','3','3','0',' ','M','S'},
+    {'3', '0'}, ms_type_wpt, {0, 0, 0}
+  };
   int n = 0;
   int wpt_count = waypt_count();
 
index e096b06dc8dd9e4906e845f0d0e299ed920a671c..ecea85cad5f60a3ae239f082c233429dcd0a6cbc 100644 (file)
@@ -67,13 +67,13 @@ static short_handle read_route_wpt_mkshort_handle;
 #define MPSDESCBUFFERLEN       4096
 
 
-char* snlen = NULL;
-char* snwhiteopt = NULL;
-char* mpsverout = NULL;
-char* mpsmergeouts = NULL;
-int   mpsmergeout;
-char* mpsusedepth = NULL;
-char* mpsuseprox = NULL;
+static char* snlen = NULL;
+static char* snwhiteopt = NULL;
+static char* mpsverout = NULL;
+static char* mpsmergeouts = NULL;
+static int   mpsmergeout;
+static char* mpsusedepth = NULL;
+static char* mpsuseprox = NULL;
 
 static
 arglist_t mps_args[] = {
index 2082745f7a1c29b627507ff1b79c2be8a50e882e..1d9b9eaa48ec43eeacc35ff7ed12aeb62384f741 100644 (file)
@@ -160,7 +160,8 @@ nav_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr)
         } else if (!strcmp(ap[1], "moving_travelling")) {
           wpt_tmp->icon_descr = "Geocache-moving";
         } else {
-          xasprintf(&wpt_tmp->icon_descr,
+          // WARNING: casting away const-ness.
+          xasprintf((char**)&wpt_tmp->icon_descr,
                     "Geocache-%-.20s", ap[1]);
         }
       } else if (0 == strcmp(ap[0], "hidden_date")) {
index 17166b7f27265e72aa65dec5dd250586ddd6d6ae..93999596c23078aa5a5b0260fbd250ccde4e10f5 100644 (file)
@@ -415,7 +415,7 @@ static void ovl_rd_deinit(void)
 }
 
 /*------------------------------------------*/
-void ovl_read_parameter(char* fname)
+void ovl_read_parameter(const char* fname)
 {
   gbfile*    fpin;
   arglist_t* p;
index 3b3ff654f533e5332651862b65a30b064e585e68..b46581b331b8d0c42d39c74b7f05bef3c89b68ec 100644 (file)
@@ -253,7 +253,7 @@ static void write_header(void)
   struct doc_record0 *rec0;
   --ct;
 
-  rec0 = xcalloc(1, sizeof(struct doc_record0)+(ct-1)*sizeof(short));
+  rec0 = (struct doc_record0*) xcalloc(1, sizeof(struct doc_record0)+(ct-1)*sizeof(short));
   be_write16(&rec0->version, COMPRESSED);
   be_write16(&rec0->reserved1, 0);
   be_write32(&rec0->doc_size, offset);
@@ -307,7 +307,7 @@ static void write_bookmarks(void)
 static void commit_buffer(void)
 {
 
-  struct recordsize *newrec = xcalloc(1, sizeof(struct recordsize));
+  struct recordsize *newrec = (struct recordsize*) xcalloc(1, sizeof(struct recordsize));
   newrec->next = recordsize_tail;
   newrec->size = buf.len;
   recordsize_tail = newrec;
index 061e9e32ebcc4186779e0c7427d30e0b2c739b4e..3404769647a690e8258c15e2b91d505ca5ffb1a2 100644 (file)
@@ -151,7 +151,7 @@ char *ppdb_strcat(char *dest, char *src, char *def, int *size)
   len = strlen(dest) + strlen(tmp) + 1;
   if (len > *size) {
     *size = len;
-    res = xrealloc(dest, *size);
+    res = (char*) xrealloc(dest, *size);
   } else {
     res = dest;
   }
@@ -197,9 +197,9 @@ char *str_pool_get(size_t size)
   tmp = str_pool[str_poolp];
 
   if (str_pool_s[str_poolp] == 0) {
-    tmp = xmalloc(size);
+    tmp = (char*) xmalloc(size);
   } else if (str_pool_s[str_poolp] < size) {
-    tmp = xrealloc(tmp, size);
+    tmp = (char*) xrealloc(tmp, size);
   } else {
     return tmp;
   }
@@ -426,7 +426,7 @@ int ppdb_read_wpt(route_head *head, int isRoute)
   double altfeet;
   struct tm tm;
 
-  while (pdb_read_rec(file_in, NULL, NULL, NULL, (void *)&data) >= 0) {
+  while (pdb_read_rec(file_in, NULL, NULL, NULL, (void **)&data) >= 0) {
     waypoint *wpt_tmp = waypt_new();
     int line = 0;
     char *tmp = data;
@@ -654,7 +654,7 @@ static void ppdb_write_wpt(const waypoint *wpt)
   int len;
   struct tm tm;
 
-  buff = xcalloc(REC_SIZE, 1);
+  buff = (char *) xcalloc(REC_SIZE, 1);
 
   if (wpt->latitude < 0) {
     latdir = 'S';
@@ -752,7 +752,7 @@ static void ppdb_write(void)
    *   if (global_opts.objective != wptdata)   / * Waypoint target do not need appinfo block * /
    *   {
    */
-  appinfo = xcalloc(1, sizeof(*appinfo));
+  appinfo = (ppdb_appdata_t *) xcalloc(1, sizeof(*appinfo));
   file_out->appinfo = (void *)appinfo;
   file_out->appinfo_len = PPDB_APPINFO_SIZE;
   /*   }
index 78205fe4dea824acf47dec9670f683c435412b44..0b6af46f0b0956d928d47d2d3fea9d849bef9a71 100644 (file)
@@ -63,15 +63,15 @@ pdb_read_tail(gbfile *fin, gbuint32 *size)
       res = (char *) xmalloc(count);
       memcpy(res, buff, count);
     } else {
-      res = xrealloc(res, bytes + count);
+      res = (char*) xrealloc(res, bytes + count);
       memcpy(&res[bytes], buff, count);
     }
     bytes += count;
   }
   if (res) {
-    res = xrealloc(res, bytes + 1);
+    res = (char*) xrealloc(res, bytes + 1);
   } else {
-    res = xmalloc(1);
+    res = (char*) xmalloc(1);
   }
   res[bytes] = '\0';
 
@@ -133,7 +133,7 @@ pdb_load_data(pdbfile *fin)
   for (i = 0; i < ct; i++) {
     pdbrec_t *rec;
 
-    rec = xcalloc(1, sizeof(*rec));
+    rec = (pdbrec_t*) xcalloc(1, sizeof(*rec));
     if (fin->attr & PDB_FLAG_RESOURCE) {
       (void) gbfgetuint32(fin->file);  /* type */
       rec->id = gbfgetint16(fin->file);
@@ -205,14 +205,14 @@ pdb_load_data(pdbfile *fin)
     if (rec->next) {
       rec->size = (gbint32)rec->next->offs - (gbint32)offs;
       if (rec->size > 0) {
-        rec->data = xmalloc(rec->size);
+        rec->data = (char*) xmalloc(rec->size);
         rec->size = gbfread(rec->data, 1, rec->size, fin->file);
         offs += rec->size;
       } else if (rec->size < 0) {
         pdb_invalid_file(fin, "Wrong data size in record with id %d.\n", rec->id);
       }
     } else {
-      rec->data = pdb_read_tail(fin->file, &rec->size);
+      rec->data = (char*) pdb_read_tail(fin->file, &rec->size);
       offs += rec->size;
     }
   }
@@ -223,7 +223,7 @@ pdb_open(const char *filename, const char *module)
 {
   pdbfile *res;
 
-  res = xcalloc(1, sizeof(*res));
+  res = (pdbfile*) xcalloc(1, sizeof(*res));
   res->file = gbfopen_be(filename, "rb", module);
   res->mode = 1;
 
@@ -260,7 +260,7 @@ pdb_create(const char *filename, const char *module)
 {
   pdbfile *res;
 
-  res = xcalloc(1, sizeof(*res));
+  res = (pdbfile*) xcalloc(1, sizeof(*res));
   strncpy(res->name, "Palm/OS Database", PDB_DBNAMELEN);
   res->file = gbfopen_be(filename, "wb", module);;
   res->mode = 2;
@@ -273,13 +273,13 @@ pdb_write_rec(pdbfile *fout, const gbuint8 flags, const gbuint8 category, const
 {
   pdbrec_t *rec, *cur;
 
-  rec = xcalloc(1, sizeof(*rec));
+  rec = (pdbrec_t*) xcalloc(1, sizeof(*rec));
   rec->category = category;
   rec->flags = category;
   rec->id = rec_id;
   rec->size = size;
   if (size > 0) {
-    rec->data = xmalloc(size);
+    rec->data = (char*) xmalloc(size);
     memcpy(rec->data, data, size);
   }
 
index fb71eb1a2b5d163aa274c6ab24cccaae1667866e..e7f788492e2ffb7ded5148034df104a135168046 100755 (executable)
@@ -114,7 +114,7 @@ read_tracks(void)
     wpt->pdop = le_read_float(&bc.espe);
     wpt->course = le_read_float(&bc.course);
     wpt->speed = le_read_float(&bc.speed);
-    wpt->fix = (fix_type) le_readu16(&bc.fix) - 1;
+    wpt->fix = (fix_type) (le_readu16(&bc.fix) - 1);
 
     track_add_wpt(trk_head, wpt);
   }
index e8b6269aeb4a9d06580064a091da18a4b800b5cd..965ac7a04808155186a2079acaa59cd619a552fa 100644 (file)
@@ -278,9 +278,9 @@ void
 poly_init(const route_head *h)
 {
   int ct = track_waypt_count();
-  polybufx = xcalloc(ct, sizeof(double));
-  polybufy = xcalloc(ct, sizeof(double));
-  polybufz = xcalloc(ct, sizeof(double));
+  polybufx = (double*) xcalloc(ct, sizeof(double));
+  polybufy = (double*) xcalloc(ct, sizeof(double));
+  polybufz = (double*) xcalloc(ct, sizeof(double));
 }
 
 
index bf6af7ff32c6b00b5d2275012f1ad809d6f3d6d1..b98057583ea7d962ac1b30f8504af966b028e467 100644 (file)
@@ -244,7 +244,7 @@ wr_buf(const unsigned char *str, int len)
 
 gbuint8 NL[2] = { 0x0D, 0x0A };
 gbuint8 MSG_START[2] = { 0xA0, 0xA1 };
-gbuint8 SECTOR_READ_END[13] = "END\0CHECKSUM=";
+gbuint8 SECTOR_READ_END[] = "END\0CHECKSUM=";
 
 static int
 skytraq_calc_checksum(const unsigned char *buf, int len)
@@ -288,9 +288,9 @@ skytraq_rd_msg(const void *payload, int len)
   }
 
   db(2, "Receiving message with %i bytes of payload (expected >=%i)\n", rcv_len, len);
-  rd_buf(payload, MIN(rcv_len, len));
+  rd_buf((const unsigned char*) payload, MIN(rcv_len, len));
 
-  calc_cs = skytraq_calc_checksum(payload, MIN(rcv_len, len));
+  calc_cs = skytraq_calc_checksum((const unsigned char*) payload, MIN(rcv_len, len));
   for (i = 0; i < rcv_len-len; i++) {
     c = rd_char(&errors);
     calc_cs ^= c;
@@ -507,7 +507,7 @@ static unsigned int me_read32(const unsigned char *p)
 }
 
 struct read_state {
-  route_head          *route_head;
+  route_head          *route_head_;
   unsigned            wpn, tpn;
 
   time_t ts;
@@ -524,7 +524,7 @@ state_init(struct read_state *pst)
   track->rte_desc = xstrdup("SkyTraq GPS tracklog data");
   track_add_head(track);
 
-  pst->route_head = track;
+  pst->route_head_ = track;
   pst->wpn        = 0;
   pst->tpn        = 0;
 
@@ -709,13 +709,13 @@ process_data_item(struct read_state *pst, const item_frame *pitem, int len)
       waypt_add(waypt_dupe(tpt));
     }
 
-    if (0 == pst->route_head) {
+    if (0 == pst->route_head_) {
       db(1, MYNAME ": New Track\n");
-      pst->route_head = route_head_alloc();
-      track_add_head(pst->route_head);
+      pst->route_head_ = route_head_alloc();
+      track_add_head(pst->route_head_);
     }
 
-    track_add_wpt(pst->route_head, tpt);
+    track_add_wpt(pst->route_head_, tpt);
   }
 
   return res;
index 6991f89d9859604bf78a32beaabb9b944062eb26..ea6b515657bdf407485c42bab4933c533428aac7 100644 (file)
@@ -190,7 +190,7 @@ finalize_tracks(void)
     return;
   }
 
-  list = (void *)xmalloc(count * sizeof(*list));
+  list = (waypoint**)xmalloc(count * sizeof(*list));
 
   index = 0;
   QUEUE_FOR_EACH(&trackpts, elem, tmp) {
@@ -795,8 +795,8 @@ ff_vecs_t stmsdf_vecs = {
   ff_type_file,
   {
     ff_cap_none,
-    ff_cap_read | ff_cap_write,
-    ff_cap_read | ff_cap_write
+    (ff_cap)(ff_cap_read | ff_cap_write),
+    (ff_cap)(ff_cap_read | ff_cap_write)
   },
   rd_init,
   wr_init,
index b7a3794e95897a6b74212e7fdb7a94fbcde07a74..b3c7033977fb1c61db602eb1620d5433d4ab6847 100644 (file)
@@ -81,7 +81,7 @@ stmwpp_data_read(void)
 
   what = STM_NOTHING;
   buff = gbfgetstr(fin);
-  buff = (buff == NULL) ? "" : buff;
+  buff = (buff == NULL) ? (char *) "" : buff;
 
   if (case_ignore_strncmp(buff, "Datum,WGS 84,WGS 84,", 20) != 0) {
     fatal(MYNAME ": Invalid GPS datum or not \"WaypointPlus\"\" file!\n");